<!DOCTYPE html>
<html lang="en-US">
  <head>
    <link href="/assets/index.css" rel="stylesheet" type="text/css" />
    <script crossorigin="anonymous" src="/test-harness.js"></script>
    <script crossorigin="anonymous" src="/test-page-object.js"></script>
    <script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
    <style type="text/css">
      input:focus {
        background-color: #B60000 !important;
        color: White !important;
      }
    </style>
  </head>
  <body>
    <main id="webchat"></main>
    <script>
      run(async function () {
        WebChat.renderWebChat(
          {
            directLine: testHelpers.createDirectLineWithTranscript(
              testHelpers.transcriptNavigation.generateTranscript()
            ),
            store: testHelpers.createStore()
          },
          document.getElementById('webchat')
        );

        await pageConditions.uiConnected();
        await pageConditions.numActivitiesShown(32);
        await pageConditions.scrollToBottomCompleted();

        await pageObjects.focusSendBoxTextBox();

        // Should focus on the first input box of Adaptive Card, this is our starting point.
        await host.sendShiftTab(3);
        await host.sendKeys('ARROW_UP', 'ARROW_UP');
        await pageConditions.scrollStabilized();
        await pageConditions.focusedActivityInView();

        await host.sendKeys('ENTER');
        await host.snapshot();

        // Press ESCAPE key should focus the activity.
        await host.sendKeys('ESCAPE');
        await host.snapshot();

        // Press ESCAPE key should focus the send box.
        await host.sendKeys('ESCAPE');
        await host.snapshot();
      });
    </script>
  </body>
</html>
